﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using VOL.Entity.AttributeManager;
using VOL.Entity.SystemModels;

namespace VOL.Entity.DomainModels.WorkforceManagement
{
    /// <summary>
    /// 工作排班明细表
    /// </summary>
    [Table("WorkforceDetail")]
    [EntityAttribute(TableCnName = "工作排班明细")]
    public class WorkforceDetail : BaseEntity
    {
        /// <summary>
        /// 主键ID
        /// </summary>
        [Key]
        [Column("Id")]
        [Display(Name = "ID")]
        [Required(AllowEmptyStrings = false)]
        public int Id { get; set; }

        /// <summary>
        /// 排班计划Id
        /// </summary>
        [Column("PlanId")]
        [Display(Name = "排班计划Id")]
        public int PlanId { get; set; }

        /// <summary>
        /// 班组ID
        /// </summary>
        [Column("GroupId")]
        [Display(Name = "班组ID")]
        [Required(AllowEmptyStrings = false)]
        public int GroupId { get; set; }

        /// <summary>
        /// 班组类型
        /// </summary>
        [Column("GroupType")]
        [Display(Name = "班组类型")]
        [StringLength(50)]
        public string GroupType { get; set; }

        /// <summary>
        /// 班组名称
        /// </summary>
        [Column("GroupName")]
        [Display(Name = "班组名称")]
        [StringLength(50)]
        [Required(AllowEmptyStrings = false)]
        public string GroupName { get; set; }

        /// <summary>
        /// 工作日期
        /// </summary>
        [Column("WorkDate")]
        [Display(Name = "工作日期")]
        [Required(AllowEmptyStrings = false)]
        public DateTime WorkDate { get; set; }

        /// <summary>
        /// 班次(0白班1夜班)
        /// </summary>
        [Column("WorkShift")]
        [Display(Name = "班次")]
        public int WorkShift { get; set; }

        /// <summary>
        /// 节假日类型
        /// </summary>
        [Column("DayType")]
        [Display(Name = "节假日类型")]
        public int DayType { get; set; }

        /// <summary>
        /// 状态: 0-休息, 1-正常上班 (从WorkShift映射)
        /// </summary>
        [NotMapped]
        public int Status => WorkShift >= 0 ? 1 : 0;

        /// <summary>
        /// 备注 (从其他表关联)
        /// </summary>
        [NotMapped]
        public string Remark { get; set; }

    }
}
